package org.egedede.processmanager.logs;

import org.joda.time.*;
import org.joda.time.format.*;
public class LogEntry{
	private DateTimeFormatter formatter = new DateTimeFormatterBuilder()
     .appendYear(4, 4)
     .appendLiteral('/')
     .appendMonthOfYear(2)
     .appendLiteral('/')
	 .appendDayOfYear(2)
     .appendLiteral(' ')
	 .appendHourOfDay(2)
     .appendLiteral(':')
	 .appendMinuteOfHour(2)
     .appendLiteral(':')
	 .appendSecondOfMinute(2)
     .appendLiteral('.')
	 .appendMillisOfSecond(3)
     .toFormatter();

	private String level;
	private String msg;
	private DateTime time;
	
	public LogEntry(String level, String msg, DateTime time){
		this.level = level;
		this.msg = msg;
		this.time = time;
	}
	
	public String getLevel(){
		return level;
	}
	
	public String getMessage(){
		return msg;
	}
	
	public DateTime getTime(){
		return time;
	}
	
		
	public String toString(){
		return getMessage();
	}
	
	public String toLongString(){
		StringBuilder builder = new StringBuilder();
		builder.append(getLevel()).append("\t").
				append(formatter.print(getTime())).append("\t").
				append(getMessage());
		return builder.toString();
	}
}